-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error messages for string responses #49
Conversation
- include test for failed string response - also fix `match_json_schema` typo in README (assuming this should be `match_response_schema`).
end | ||
|
||
it "fails with message when negated" do | ||
expect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using {...} for multi-line blocks.
"id" => { "type" => "number" }, | ||
}, | ||
"additionalProperties" => false, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent the right brace the same as the first position after the preceding left parenthesis.
context "when JSON is a string" do | ||
before(:each) do | ||
create_schema("foo_schema", { | ||
"type" => "object", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis.
}) | ||
context "when JSON is a string" do | ||
before(:each) do | ||
create_schema("foo_schema", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant curly braces around a hash parameter.
Released in https://github.com/thoughtbot/json_matchers/releases/tag/v0.6.3. Thanks! |
While
match_response_schema
can now accept a string (thanks to #43), I noticed it will cause aNoMethodError
in error messages:This fix checks if response
respond_to?(:body)
before attempting to call it from the error message. Included a test for failed string responses to ensure desired behavior.Also fixed what I think is a related typo in README:
match_json_schema
should bematch_response_schema
, correct?